home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Apple Game Sprockets / InputSprocket 1.1 / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-18  |  20.1 KB  |  818 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    File:            InputSprocket.h
  3.  *
  4.  *    Version:        Input Sprocket 1.1
  5.  *
  6.  *    Dependencies:    Universal Interfaces 2.1.2 on ETO #20
  7.  *
  8.  *    Contents:        Public interfaces for InputSprocket.
  9.  *
  10.  *    Bugs:            If you find a problem with this file or InputSprocketLib,
  11.  *                    please send e-mail describing the problem in enough detail
  12.  *                    to be reproduced, and include the version number above, the
  13.  *                    version of MacOS and hardware configuration information to
  14.  *                    sprockets@adr.apple.com.
  15.  *
  16.  *    Copyright (c) 1996 Apple Computer, Inc.  All rights reserved.
  17.  */
  18.  
  19. #ifndef __INPUTSPROCKET__
  20. #define __INPUTSPROCKET__
  21.  
  22.  
  23. #ifndef __TYPES__
  24. #include <Types.h>
  25. #endif
  26. /*    #include <ConditionalMacros.h>                                */
  27.  
  28. #ifndef __EVENTS__
  29. #include <Events.h>
  30. #endif
  31.  
  32. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  33. #define USE_OLD_INPUT_SPROCKET_LABELS 1 // this will be changed to false soon
  34. #endif
  35.  
  36. #if GENERATINGPOWERPC
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=power
  44. #endif
  45.  
  46. /* ********************* data types ********************* */
  47. typedef struct ISpDevicePrivate *ISpDeviceReference;
  48. typedef struct ISpElementPrivate *ISpElementReference;
  49. typedef struct ISpElementListPrivate *ISpElementListReference;
  50. typedef OSType ISpDeviceClass;  /* general classs of device, example: keyboard, mouse, joystick */
  51. typedef OSType ISpDeviceIdentifier;   /* a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  52. typedef OSType ISpElementLabel;
  53. typedef OSType ISpElementKind;
  54.  
  55. /* *************** errors -30420 to -30439***************** */
  56.  
  57. enum
  58. {
  59.     kISpInternalErr = -30420,
  60.     kISpSystemListErr = -30421,
  61.     kISpBufferToSmallErr = -30422,
  62.     kISpElementInListErr = -30423,
  63.     kISpElementNotInListErr = - 30424,
  64.     kISpSystemInactiveErr = -30425,
  65.     kISpDeviceInactiveErr = -30426,
  66.     kISpSystemActiveErr = -30427,
  67.     kISpDeviceActiveErr = -30428,
  68.     kISpListBusyErr = -30429
  69. };
  70.  
  71. /* *************** resources **************** */
  72.  
  73. enum 
  74. {
  75.     kISpSetListResourceType = 'setl',
  76.     kISpSetDataResourceType = 'setd'
  77. };
  78.  
  79. /*
  80.  * ISpDeviceDefinition
  81.  *
  82.  * This structure provides all the available
  83.  * information for an input device within the system
  84.  *
  85.  */
  86.  
  87. typedef struct ISpDeviceDefinition
  88. {
  89.     Str63 deviceName;                                /* a human readable name of the device */
  90.     ISpDeviceClass theDeviceClass;                    /* general classs of device example : keyboard, mouse, joystick */
  91.     ISpDeviceIdentifier theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  92.     UInt32 permanentID;                                /* a cross reboot id unique within that deviceType, 0 if not possible */
  93.     UInt32 flags;                                    /* status flags */
  94.     UInt32 reserved1;
  95.     UInt32 reserved2;
  96.     UInt32 reserved3;
  97. } ISpDeviceDefinition;
  98.  
  99. enum
  100. {
  101.     kISpDeviceFlag_HandleOwnEmulation = 1
  102. };
  103.  
  104. /*
  105.  * ISpElementEvent, ISpElementEventPtr
  106.  *
  107.  * This is the structure that event data is passed in.
  108.  *
  109.  */
  110.  
  111. typedef struct ISpElementEvent
  112. {
  113.     AbsoluteTime when;                  /* this is absolute time on PCI or later, otherwise it is */
  114.                                         /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  115.     ISpElementReference element;        /* a reference to the element that generated this event */
  116.     UInt32 refCon;                        /* for application usage, 0 on the global list */
  117.     UInt32 data;                        /* the data for this event */
  118. } ISpElementEvent, *ISpElementEventPtr;
  119.  
  120. /*
  121.  * ISpElementInfo, ISpElementInfoPtr
  122.  *
  123.  * This is the generic definition of an element.
  124.  * Every element must contain this information.
  125.  *
  126.  */
  127. typedef struct ISpElementInfo
  128. {
  129.     ISpElementLabel theLabel;
  130.     ISpElementKind theKind;
  131.     Str63 theString;
  132.     UInt32 reserved1;
  133.     UInt32 reserved2;
  134. } ISpElementInfo, *ISpElementInfoPtr;
  135.  
  136. typedef struct ISpNeed
  137. {
  138.     Str63 name;
  139.     short iconSuiteResourceId;    /* resource id of the icon suite */
  140.     short reserved;
  141.     ISpElementKind theKind;
  142.     ISpElementLabel theLabel;
  143.     UInt32 flags;
  144.     UInt32 reserved1;
  145.     UInt32 reserved2;
  146.     UInt32 reserved3;
  147. } ISpNeed;
  148.  
  149. typedef UInt32 ISpNeedFlagBits;
  150. enum
  151. {
  152.     kISpNeedFlag_NoMultiConfig = 1
  153. };
  154.  
  155. /*
  156.  *
  157.  * These are the current built values for ISpDeviceClass
  158.  *
  159.  */
  160.  
  161. enum
  162. {
  163.     kISpDeviceClass_SpeechRecognition = 'talk',
  164.     kISpDeviceClass_Mouse = 'mous',
  165.     kISpDeviceClass_Keyboard = 'keyd',
  166.     kISpDeviceClass_Joystick = 'joys',
  167.     kISpDeviceClass_Wheel = 'whel',
  168.     kISpDeviceClass_Pedals = 'pedl',
  169.     kISpDeviceClass_Levers = 'levr',
  170.     kISpDeviceClass_Tickle = 'tckl'        // a device of this class requires ISpTickle
  171. };
  172.  
  173. /*
  174.  * These are the current built in ISpElementKind's
  175.  * 
  176.  * These are all OSTypes.
  177.  *
  178.  */
  179.  
  180. enum
  181. {
  182.     kISpElementKind_Button = 'butn',
  183.     kISpElementKind_DPad = 'dpad',
  184.     kISpElementKind_Axis = 'axis',
  185.     kISpElementKind_Movement = 'move',
  186.     kISpElementKind_Virtual = 'virt'
  187. };
  188.  
  189.  
  190. /*
  191.  *
  192.  * These are the current built in ISpElementLabel's
  193.  *
  194.  * These are all OSTypes.
  195.  *
  196.  */
  197.  
  198. #if USE_OLD_INPUT_SPROCKET_LABELS 
  199. enum
  200. {
  201.     /* axis */
  202.     kISpElementLabel_XAxis = 'xaxi',
  203.     kISpElementLabel_YAxis = 'yaxi',
  204.     kISpElementLabel_ZAxis = 'zaxi',
  205.     
  206.     kISpElementLabel_Rx = 'rxax',
  207.     kISpElementLabel_Ry = 'ryax',
  208.     kISpElementLabel_Rz = 'rzax',
  209.     
  210.     kISpElementLabel_Gas = 'gasp',
  211.     kISpElementLabel_Brake = 'brak',
  212.     kISpElementLabel_Clutch = 'cltc',
  213.     
  214.     kISpElementLabel_Throttle = 'thrt',
  215.     kISpElementLabel_Trim = 'trim',
  216.     
  217.     /* direction pad */
  218.     kISpElementLabel_POVHat = 'povh',
  219.     kISpElementLabel_PadMove = 'move',
  220.     
  221.     /* buttons */
  222.     kISpElementLabel_Fire = 'fire',
  223.     kISpElementLabel_Start = 'strt',
  224.     kISpElementLabel_Select = 'optn'
  225. };
  226. #endif
  227.  
  228. enum
  229. {
  230.     /* generic */
  231.     kISpElementLabel_None = 'none',
  232.     
  233.     /* axis */
  234.     kISpElementLabel_Axis_XAxis = 'xaxi',
  235.     kISpElementLabel_Axis_YAxis = 'yaxi',
  236.     kISpElementLabel_Axis_ZAxis = 'zaxi',
  237.     
  238.     kISpElementLabel_Axis_Rx = 'rxax',
  239.     kISpElementLabel_Axis_Ry = 'ryax',
  240.     kISpElementLabel_Axis_Rz = 'rzax',
  241.     
  242.     kISpElementLabel_Axis_Gas = 'gasp',
  243.     kISpElementLabel_Axis_Brake = 'brak',
  244.     kISpElementLabel_Axis_Clutch = 'cltc',
  245.     
  246.     kISpElementLabel_Axis_Throttle = 'thrt',
  247.     kISpElementLabel_Axis_Trim = 'trim',
  248.     kISpElementLabel_Axis_Rudder = 'rudd',
  249.     
  250.     /* direction pad */
  251.     kISpElementLabel_Pad_POV = 'povh',
  252.     kISpElementLabel_Pad_Move = 'move',
  253.     
  254.     /* buttons */
  255.     kISpElementLabel_Btn_Fire = 'fire',
  256.     kISpElementLabel_Btn_SecondaryFire = 'sfir',
  257.     kISpElementLabel_Btn_Jump = 'jump',
  258.     kISpElementLabel_Btn_PauseResume = 'strt',    
  259.     /* kISpElementLabel_Btn_PauseResume automatically binds to escape */
  260.     kISpElementLabel_Btn_Select = 'optn',
  261.     
  262.     kISpElementLabel_Btn_SlideLeft = 'blft',
  263.     kISpElementLabel_Btn_SlideRight = 'brgt',
  264.     
  265.     kISpElementLabel_Btn_MoveForward = 'btmf',
  266.     kISpElementLabel_Btn_MoveBackward = 'btmb',
  267.     
  268.     kISpElementLabel_Btn_TurnLeft = 'bttl',
  269.     kISpElementLabel_Btn_TurnRight = 'bttr',
  270.     
  271.     kISpElementLabel_Btn_LookLeft = 'btll',
  272.     kISpElementLabel_Btn_LookRight = 'btlr',
  273.     kISpElementLabel_Btn_LookUp = 'btlu',
  274.     kISpElementLabel_Btn_LookDown = 'btld',
  275.     
  276.     kISpElementLabel_Btn_Next = 'btnx',
  277.     kISpElementLabel_Btn_Previous = 'btpv',
  278.     
  279.     kISpElementLabel_Btn_SideStep = 'side',
  280.     kISpElementLabel_Btn_Run = 'quik',
  281.     kISpElementLabel_Btn_Look = 'blok'
  282. };
  283.  
  284. /*
  285.  *
  286.  * direction pad data & configuration information
  287.  *
  288.  */
  289.  
  290. typedef UInt32 ISpDPadData;
  291. enum
  292. {
  293.     kISpPadIdle = 0,
  294.     kISpPadLeft,
  295.     kISpPadUpLeft,
  296.     kISpPadUp,
  297.     kISpPadUpRight,
  298.     kISpPadRight,
  299.     kISpPadDownRight,
  300.     kISpPadDown,
  301.     kISpPadDownLeft
  302. };
  303.  
  304. typedef struct ISpDPadConfigurationInfo
  305. {
  306.     UInt32 id;                /* ordering 1..n, 0 = no relavent ordering of direction pads */
  307.     Boolean fourWayPad;        /* true if this pad can only produce idle + four directions */
  308. } ISpDPadConfigurationInfo;
  309.  
  310. /*
  311.  *
  312.  * button data & configuration information
  313.  *
  314.  */
  315.  
  316. typedef UInt32 ISpButtonData;
  317. enum
  318. {
  319.     kISpButtonUp = 0,
  320.     kISpButtonDown = 1
  321. };
  322.  
  323. typedef struct ISpButtonConfigurationInfo
  324. {
  325.     UInt32 id;                /* ordering 1..n, 0 = no relavent ordering of buttons */
  326. } ISpButtonConfigurationInfo;
  327.  
  328. /*
  329.  *
  330.  * axis data & configuration information 
  331.  *
  332.  */
  333.  
  334. #define    kISpAxisMinimum  0x00000000U
  335. #define    kISpAxisMiddle   0x7FFFFFFFU
  336. #define    kISpAxisMaximum  0xFFFFFFFFU
  337.  
  338. typedef struct ISpAxisConfigurationInfo
  339. {
  340.     Boolean    symetricAxis;    /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  341. } ISpAxisConfigurationInfo;
  342.  
  343.  
  344. typedef struct ISpMovementData
  345. {
  346.     UInt32 xAxis;
  347.     UInt32 yAxis;
  348.     UInt32 direction;    /* ISpDPadData version of the movement */
  349. } ISpMovementData;
  350.  
  351. enum
  352. {
  353.     kISpVirtualElementFlag_UseTempMem = 1
  354. };
  355.  
  356. enum
  357. {
  358.     kISpElementListFlag_UseTempMem = 1
  359. };
  360.  
  361. enum
  362. {
  363.     kISpFirstIconSuite = 30000,
  364.     kISpLastIconSuite = 30100,
  365.     kISpNoneIconSuite = 30000
  366. };
  367.  
  368. /* ********************* user level functions ********************* */
  369.  
  370.  
  371.  
  372. /*
  373.  *
  374.  * startup / shutdown
  375.  *
  376.  */
  377.  
  378. OSStatus ISpStartup(void);    // 1.1 or later
  379. OSStatus ISpShutdown(void); // 1.1 or later
  380.  
  381. /*
  382.  *
  383.  * polling
  384.  *
  385.  */
  386.  
  387.  OSStatus ISpTickle(void);    // 1.1 or later
  388.  
  389. /********** user interface functions **********/
  390.  
  391.  
  392. NumVersion ISpGetVersion(void);
  393.  
  394. /*
  395.  *
  396.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  397.  *
  398.  */
  399.  
  400. OSStatus ISpElement_NewVirtual(UInt32 dataSize, ISpElementReference *outElement, UInt32 flags);
  401.  
  402. /*
  403.  *
  404.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  405.  *
  406.  */
  407.  
  408. OSStatus ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeed *needs, ISpElementReference *outElements, UInt32 flags);
  409.  
  410. /*
  411.  *
  412.  * ISpElement_DisposeVirtual(inElement);
  413.  *
  414.  */
  415.  
  416. OSStatus ISpElement_DisposeVirtual(UInt32 count, ISpElementReference *inElements);
  417.  
  418. /*
  419.  * ISpInit
  420.  *
  421.  */
  422.  
  423. OSStatus ISpInit(
  424.     UInt32 count,
  425.     ISpNeed *needs,
  426.     ISpElementReference *inReferences,
  427.     OSType appCreatorCode,
  428.     OSType subCreatorCode,
  429.     UInt32 flags,
  430.     short setListResourceId, 
  431.     UInt32 version);
  432.     
  433.     
  434. /*
  435.  * ISpConfigure
  436.  *
  437.  */
  438.  
  439. typedef Boolean (*ISpEventProcPtr) (EventRecord* inEvent);
  440.  
  441. OSStatus ISpConfigure(ISpEventProcPtr inEventProcPtr);
  442.  
  443. /*
  444.  *
  445.  * ISpStop
  446.  *
  447.  */
  448.  
  449. OSStatus ISpStop(void);
  450.  
  451. /*
  452.  *
  453.  * ISpSuspend, ISpResume
  454.  *
  455.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  456.  * ISpResume resumes to the previous state of the system after a suspend call.
  457.  * 
  458.  * Return Codes
  459.  * memFullErr
  460.  *
  461.  */
  462.  
  463. OSStatus ISpSuspend(void);
  464. OSStatus ISpResume(void);
  465.  
  466. /*
  467.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  468.  *
  469.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  470.  *
  471.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  472.  * buffer - a pointer to your buffer
  473.  * outCount - contains the number of devices in the system
  474.  *
  475.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  476.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  477.  *
  478.  * Return Codes
  479.  * paramErr
  480.  *
  481.  */
  482.  
  483. OSStatus ISpDevices_Extract(UInt32 inBufferCount, UInt32 *outCount, ISpDeviceReference *buffer);
  484. OSStatus ISpDevices_ExtractByClass(ISpDeviceClass inClass, UInt32 inBufferCount, UInt32 *outCount, ISpDeviceReference *buffer);
  485. OSStatus ISpDevices_ExtractByIdentifier(ISpDeviceIdentifier inIdentifier, UInt32 inBufferCount, UInt32 *outCount, ISpDeviceReference *buffer);
  486.  
  487.  
  488. /*
  489.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  490.  *
  491.  * ISpDevices_Activate, ISpDevices_Deactivate
  492.  *
  493.  * This will activate/deactivate a block of devices.
  494.  * inDeviceCount - the number of devices to activate / deactivate
  495.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  496.  *
  497.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  498.  * inClass - the class of devices to activate or deactivate
  499.  *
  500.  * ISpDevice_IsActive
  501.  * inDevice - the device reference that you wish to 
  502.  * outIsActive - a boolean value that is true when the device is active
  503.  *
  504.  * Return Codes
  505.  * paramErr
  506.  *
  507.  */
  508.  
  509. OSStatus ISpDevices_ActivateClass(ISpDeviceClass inClass);        // 1.1 or later
  510. OSStatus ISpDevices_DeactivateClass(ISpDeviceClass inClass);    // 1.1 or later
  511. OSStatus ISpDevices_Activate(UInt32 inDeviceCount, ISpDeviceReference *inDevicesToActivate);
  512. OSStatus ISpDevices_Deactivate(UInt32 inDeviceCount, ISpDeviceReference *inDevicesToDeactivate);
  513. OSStatus ISpDevice_IsActive(ISpDeviceReference inDevice, Boolean *outIsActive);
  514.  
  515. /*
  516.  * ISpDevice_GetDefinition
  517.  *
  518.  *
  519.  * inDevice - the device you want to get the definition for
  520.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  521.  * outStruct - a pointer to where you want the structure copied
  522.  *
  523.  * Return Codes
  524.  * paramErr
  525.  *
  526.  */
  527.  
  528. OSStatus ISpDevice_GetDefinition(const ISpDeviceReference inDevice, UInt32 inBuflen, ISpDeviceDefinition *outStruct);
  529.  
  530.  
  531. /*
  532.  *
  533.  * ISpDevice_GetElementList
  534.  *
  535.  * inDevice - the device whose element list you wish to get
  536.  * outElementList - a pointer to where you want a reference to that list stored
  537.  *
  538.  * Return Codes
  539.  * paramErr
  540.  *
  541.  */
  542.  
  543. OSStatus ISpDevice_GetElementList(const ISpDeviceReference inDevice, ISpElementListReference *outElementList);
  544.  
  545. /*
  546.  *
  547.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  548.  * no group
  549.  *
  550.  * Return Codes
  551.  * paramErr
  552.  *
  553.  */
  554.  
  555. OSStatus ISpElement_GetGroup(const ISpElementReference inElement, UInt32 *outGroup);
  556.  
  557. /*
  558.  *
  559.  * takes an ISpElementReference and returns the device that the element belongs 
  560.  * to.
  561.  *
  562.  * Return Codes
  563.  * paramErr if inElement is 0 or outDevice is nil
  564.  *
  565.  */
  566.  
  567. OSStatus ISpElement_GetDevice(const ISpElementReference inElement, ISpDeviceReference *outDevice);
  568.         
  569. /*
  570.  *
  571.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  572.  * the set of standard information.  You get ISpElementKind specific information
  573.  * through ISpElement_GetConfigurationInfo.
  574.  *
  575.  * Return Codes
  576.  * paramErr if inElement is 0 or outInfo is nil
  577.  *
  578.  */
  579.  
  580. OSStatus ISpElement_GetInfo(const ISpElementReference inElement, ISpElementInfoPtr outInfo);
  581.         
  582. /*
  583.  *
  584.  *         
  585.  *
  586.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  587.  * 
  588.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  589.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  590.  * will return something error.
  591.  *
  592.  * Return Codes
  593.  * paramErr if inElement or configInfo is nil
  594.  *
  595.  */
  596.  
  597. OSStatus ISpElement_GetConfigurationInfo(const ISpElementReference inElement, UInt32 buflen, void *configInfo);
  598.     
  599. /*
  600.  *
  601.  * ISpElement_GetSimpleState
  602.  *
  603.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  604.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  605.  * whose data fits in a signed 32 bit integer.
  606.  *
  607.  *
  608.  *
  609.  * Return Codes
  610.  * paramErr if inElement is 0 or state is nil
  611.  *
  612.  */
  613.  
  614. OSStatus ISpElement_GetSimpleState(const ISpElementReference inElement, UInt32 *state);
  615.  
  616. /*
  617.  *
  618.  * ISpElement_GetComplexState
  619.  *
  620.  * Takes an ISpElementReference and returns the current state of that element.  
  621.  * Will copy up to buflen bytes of the current state of the device into
  622.  * state.
  623.  *
  624.  *
  625.  * Return Codes
  626.  * paramErr if inElement is 0 or state is nil
  627.  *
  628.  */
  629.  
  630. OSStatus ISpElement_GetComplexState(const ISpElementReference inElement, UInt32 buflen, void *state);
  631.  
  632.  
  633. /*
  634.  * ISpElement_GetNextEvent
  635.  *
  636.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  637.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  638.  * was not enough space to fill in the whole event structure that event will be
  639.  * dequed, as much of the event as will fit in the buffer will by copied and
  640.  * ISpElement_GetNextEvent will return an error.
  641.  *
  642.  * Return Codes
  643.  * paramErr
  644.  *
  645.  */
  646.  
  647. OSStatus ISpElement_GetNextEvent(ISpElementReference inElement, UInt32 bufSize, ISpElementEventPtr event, Boolean *wasEvent);
  648.  
  649. /*
  650.  *
  651.  * ISpElement_Flush
  652.  *
  653.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  654.  * that any events that made it to this layer before the time of the flush call will be flushed and
  655.  * it will not flush any events that make it to this layer after the time when the call has returned.
  656.  * What happens to events that occur during the flush is undefined.
  657.  *
  658.  *
  659.  * Return Codes
  660.  * paramErr
  661.  *
  662.  */
  663.  
  664. OSStatus ISpElement_Flush(ISpElementReference inElement);
  665.  
  666.  
  667.  
  668. /*
  669.  * ISpElementList_New
  670.  *
  671.  * Creates a new element list and returns it in outElementList.  In count specifies 
  672.  * the number of element references in the list pointed to by inElements.  If inCount
  673.  * is non zero the list is created with inCount elements in at as specified by the 
  674.  * inElements parameter.  Otherwise the list is created empty.
  675.  *
  676.  *
  677.  * Return Codes
  678.  * out of memory - If it failed to allocate the list because it was out of memory
  679.                    it will also set outElementList to 0
  680.  * paramErr if outElementList was nil
  681.  *
  682.  *
  683.  * Special Concerns
  684.  *
  685.  * interrupt unsafe
  686.  *
  687.  */
  688.  
  689. OSStatus ISpElementList_New(UInt32 inCount, ISpElementReference *inElements, ISpElementListReference *outElementList, UInt32 flags);
  690.  
  691. /*
  692.  * ISpElementList_Dispose
  693.  *
  694.  * Deletes an already existing memory list.  
  695.  *
  696.  *
  697.  * Return Codes
  698.  * paramErr if inElementList was 0
  699.  *
  700.  *
  701.  * Special Concerns
  702.  *
  703.  * interrupt unsafe
  704.  *
  705.  */
  706.  
  707. OSStatus ISpElementList_Dispose(ISpElementListReference inElementList);
  708.  
  709. /*
  710.  * ISpGetGlobalElementList
  711.  *
  712.  * returns the global element list
  713.  *
  714.  * Return Codes
  715.  * paramErr if outElementList is nil
  716.  *
  717.  */ 
  718.  
  719. OSStatus ISpGetGlobalElementList(ISpElementListReference *outElementList);
  720.  
  721. /*
  722.  * ISpElementList_AddElement
  723.  *
  724.  * adds an element to the element list
  725.  *
  726.  * Return Codes
  727.  * paramErr if inElementList is 0 or newElement is 0
  728.  * memory error if the system is unable to allocate enough memory
  729.  *
  730.  * Special Concerns
  731.  * interrupt Unsafe
  732.  * 
  733.  */
  734. OSStatus ISpElementList_AddElements(ISpElementListReference inElementList, UInt32 refCon, UInt32 count, ISpElementReference *newElements);
  735.  
  736. /*
  737.  * ISpElementList_RemoveElement
  738.  *
  739.  * removes the specified element from the element list
  740.  *
  741.  * Return Codes
  742.  * paramErr if inElementList is 0 or oldElement is 0
  743.  * memory error if the system is unable to allocate enough memory
  744.  *
  745.  * Special Concerns
  746.  * interrupt Unsafe
  747.  * 
  748.  */
  749.  
  750. OSStatus ISpElementList_RemoveElements(ISpElementListReference inElementList, UInt32 count, ISpElementReference *oldElement);
  751.  
  752. /*
  753.  * ISpElementList_Extract
  754.  *
  755.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  756.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  757.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  758.  * that number and the size of the array into the buffer.
  759.  *
  760.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  761.  * that have the specified kind and label.
  762.  *
  763.  * Return Codes
  764.  * paramErr
  765.  *
  766.  */
  767.  
  768. OSStatus ISpElementList_Extract(ISpElementListReference inElementList, UInt32 inBufferCount, UInt32 *outCount, ISpElementReference *buffer);
  769. OSStatus ISpElementList_ExtractByKind(ISpElementListReference inElementList, ISpElementKind inKind, UInt32 inBufferCount, UInt32 *outCount, ISpElementReference *buffer);
  770. OSStatus ISpElementList_ExtractByLabel(ISpElementListReference inElementList, ISpElementLabel inLabel, UInt32 inBufferCount, UInt32 *outCount, ISpElementReference *buffer);
  771.  
  772. /*
  773.  * ISpElementList_GetNextEvent
  774.  *
  775.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  776.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  777.  * was not enough space to fill in the whole event structure that event will be
  778.  * dequed, as much of the event as will fit in the buffer will by copied and
  779.  * ISpElementList_GetNextEvent will return an error.
  780.  *
  781.  * Return Codes
  782.  * paramErr
  783.  *
  784.  */
  785.  
  786. OSStatus ISpElementList_GetNextEvent(ISpElementListReference inElementList, UInt32 bufSize, ISpElementEventPtr event, Boolean *wasEvent);
  787.  
  788. /*
  789.  *
  790.  * ISpElementList_Flush
  791.  *
  792.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  793.  * that any events that made it to this layer before the time of the flush call will be flushed and
  794.  * it will not flush any events that make it to this layer after the time when the call has returned.
  795.  * What happens to events that occur during the flush is undefined.
  796.  *
  797.  *
  798.  * Return Codes
  799.  * paramErr
  800.  *
  801.  */
  802.  
  803. OSStatus ISpElementList_Flush(ISpElementListReference inElementList);
  804.  
  805.  
  806. #ifdef __cplusplus
  807. }
  808. #endif
  809.  
  810.  
  811.  
  812. #if PRAGMA_ALIGN_SUPPORTED
  813. #pragma options align=reset
  814. #endif
  815.  
  816. #endif /* GENERATINGPOWERPC */
  817. #endif /* __INPUTSPROCKET__ */
  818.